function loadingShow() {
    $("#loading").show()
}

function loadingClose() {
    $("#loading").hide()
}
//var swal_idx = 0;

function alertSuccess(title, content, time) {
    top.layer.msg(title+(content?'<br>'+content:''),{time: time||1000}); //, {icon: 6}
    //top.swal(title, content, "success");
}

function alertError(title, content, icon) {
    //top.layer.msg(title+(content?'<br>'+content:''), {icon: 5,time:100000});
    //top.swal(title, content, "error");
    top.layer.alert(title+(content?'<br>'+content:''), { icon: icon||5 ,closeBtn: 0, title:false });
}

function alertWarning(title, content, func, func2) {
    top.layer.confirm(title+(content?'<br>'+content:''),{
        btn: ['确定', '取消'],
        title:false,closeBtn:0,icon:7,
        yes: function(index, layero){
            if ( typeof func !== "undefined" ) {
                func()
            }
            top.layer.close(index);
        },
        btn2:function(){
            typeof(func2)=='function' && func2();
        }
    });
    /*
    top.swal({
            title: title,
            text: content,
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            closeOnConfirm: true
        },
        function(){
            if ( typeof func !== "undefined" ) {
                func()
            }
    });*/
}

function alertInput(title, content, value, func) {
    var index = top.swal({
            title: title,
            text: content,
            type: "input",
            inputValue : value,
            showCancelButton: true,
            closeOnConfirm: false,
            animation: "slide-from-top",
            // inputPlaceholder: "输入一些话"
        },
        function(inputValue){
            if ( inputValue ) {
                func(inputValue, index);
            }
            return false;
          //  top.swal.close(index);
        });
}